<?php
/*
	提现
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
defined('BY_JYA') or exit('error');
global $_RQ;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
$this->model('model')->check_worker();
if($_RQ['op']=='get'){
	$data=array();
	$data['fee']=pdo_getsum('jy_creditshop_log',array('paystatus'=>1,'uniacid'=>$_SESSION['uniacid']),'money');
	$data['num']=pdo_count('jy_creditshop_log',array('paystatus'=>1,'uniacid'=>$_SESSION['uniacid']));
	$return['data']=$data;
	$return['params']=array('type'=>0);
	set_html('title','兑换记录');
	exi($return);
}
// js 获取数据
if($_RQ['op']=='getlist'){
	$credit_types=credit_types(true);
	$params=array();
	$params['uniacid']=$_SESSION['uniacid'];
	$params['type']=intval($_RQ['type']);
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$fields=array('id','uniacid','total','mid','type','address','addressid','goodsid','money','credit','credit_type','logno','paystatus','status','dispatchstatus','remark','createtime');
	$list=pdo_getslice('jy_creditshop_log',$params,array($pindex,$psize),$total,$fields,'','id desc');
	if($list){
		foreach($list as &$item){
				$item['credittitle']=$credit_types[$item['credit_type']];
				$item['title']=pdo_getcolumn('jy_creditshop_goods',array('uniacid'=>$_SESSION['uniacid'],'id'=>$item['goodsid']),'title');
				$item['goods_thumb']=pdo_getcolumn('jy_creditshop_goods',array('uniacid'=>$_SESSION['uniacid'],'id'=>$item['goodsid']),'thumb');
				$item['member']=cfc('core')->member_show($item['mid']);
				if($item['addressid'] || $item['address']){
					$item['isaddress']=1;
				}
				$item['total']=$item['total']?:1;
				$item['createtime']=date('Y-m-d H:i:s',$item['createtime']);
				
		}
	}	
	$return['list']=$list;
	exi($return);
}